package nnet2.net;

import java.util.LinkedList;

/**
 * Created by IntelliJ IDEA.
 * User: kalin
 * Date: 2009-11-24
 * Time: 18:49:10
 * To change this template use File | Settings | File Templates.
 */
public class RecursiveMemory {
    private LinkedList<Float> buffer = new LinkedList<Float>();
    private int size;

    public RecursiveMemory(int size){
        this.size = size;
        for (int i = 0; i < size; i++)
            this.buffer.add(0.0f);
    }

    public void push(float f){
        this.buffer.remove();
        this.buffer.add(f);
    }

    public float get(int i){
        return this.buffer.get(i);
    }

    public float[] getValues(){
        float[] values = new float[this.size];
        for (int i = 0; i < this.size; i++)
            values[i] = this.buffer.get(i);
        return values;
    }
}
